<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>管理系统</title>
	<!-- Tell the browser to be responsive to screen width -->
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<!-- Bootstrap 3.3.6 -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
	<!-- Font Awesome -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
	<!-- Ionicons -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css">
	
	<!-- layer -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/layer/3.0.1/skin/default/layer.min.css">
	<!-- Theme style -->
	<link rel="stylesheet" href="../adminlte/dist/css/AdminLTE.min.css">
	<link rel="stylesheet" href="../adminlte/dist/css/skins/_all-skins.min.css">
	
	<!-- loading -->
	<link rel="stylesheet" href="../css/jquery.mloading.css">
	
	<link rel="stylesheet" href="../css/byking.css">

	<link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body class="hold-transition skin-blue sidebar-mini" >
	<div class="wrapper" id="main">
		
		<!-- 首页头部 -->
  		<header class="main-header">
			<!-- Logo -->
			<a href="#" class="logo">
				<span class="logo-lg"><b>后台管理系统</b></span>
		    </a>
    		<!-- ./Logo -->
    		
    		<!-- Header Navbar: style can be found in header.less -->
   			<nav class="navbar navbar-static-top">
   			
				<!-- 显示/隐藏 菜单栏 -->
				<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
					<span class="sr-only">Toggle navigation</span>
				</a>
				<!-- ./显示/隐藏 菜单栏 -->
				
				<!--  -->
				<div class="navbar-custom-menu">
        			<ul class="nav navbar-nav">
          				<!-- User Account: style can be found in dropdown.less -->
          				<li class="dropdown user user-menu">
          					<!-- 账号名称 -->
				            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<span class="hidden-xs">{{name}}</span>
				            </a>
				            <!-- ./账号名称 -->
				            
				            <!-- 用户操作面板 -->
							<ul class="dropdown-menu">
              					<li class="user-body">
									<div class="row">
										<!-- 修改资料操作 -->
										<div class="col-xs-4 text-center">
 											<a href="#" class="btn btn-default btn-flat" @click="modifyInfo">修改资料</a>
										</div>
										<!-- ./修改资料操作 -->
										
										<!-- 修改密码操作 -->
										<div class="col-xs-4 text-center">
											<a href="#" class="btn btn-default btn-flat" @click="modifyPassword">修改密码</a>
										</div>
										<!-- ./修改密码操作 -->
										
										<!-- 登出操作 -->
										<div class="col-xs-4 text-center">
											<a href="#" class="btn btn-default btn-flat" @click="logout">登出</a>
										</div>
										<!-- ./登出操作 -->
									</div>
									
              					</li>
            				</ul>
            				<!-- ./用户操作面板 -->
          				</li>
					</ul>
				</div>
			</nav>
			
		</header>
		<!-- ./首页头部 -->
		
  		<!-- 菜单域 -->
		<aside class="main-sidebar">
    		<!-- sidebar: style can be found in sidebar.less -->
    		<section class="sidebar">
    
				<!-- 菜单列表 -->
				<ul class="sidebar-menu" id="menu" >
					<li class="header">菜单列表</li>
       
					<!-- 1级菜单 -->
					<li class="treeview" v-for="level1 in menulist">
						<a href="javascript:void(0)" class="openView">
							<i class="{{level1.image}}"></i>
							<span>{{level1.menu_name}}</span>
							<i class="fa fa-angle-left pull-right"></i>
						</a>
     		
						<!-- 2级菜单 -->
						<ul class="treeview-menu" v-if="level1.childMenus">
							<li   v-for="level2 in level1.childMenus">
			            		<a class="openView" 
										href="javascript:void(0)">
			                    	<i class="{{level2.image}}"></i>
			                    	<span>{{level2.menu_name}}</span>
			                    	<i class="fa fa-angle-left pull-right"></i>
			                    </a>
								<!-- 3级菜单 -->
								<ul class="treeview-menu" v-if="level2.childMenus">
									<li   v-for="level3 in level2.childMenus">
					            		<a class="openView" 
												href="javascript:void(0)" @click="openMenu($event,level3)">
					                    	<i class="{{level3.image}}"></i>
					                    	<span>{{level3.menu_name}}</span>
					                    </a>
									</li>
								</ul>
								<!-- ./3级菜单 -->
								
							</li>
							
						</ul>
          				<!-- /2级菜单 -->
          	
 					</li>
					<!-- /1级菜单 -->
				</ul>
			</section>
			<!-- /.sidebar -->
		</aside>
		<!-- ./菜单域 -->

 		<!-- 内容域 -->
  		<div class="content-wrapper">
  			<!-- 内容 -->
			<section  id="myTab">
  		
  				<!-- tab栏 -->
				<ul class="nav nav-tabs" style="height: 42px">
		    		<li class="active">
		    			<a href="#home" data-toggle="tab" style="height: 42px">首页
							<i></i>
		       			 </a>      
		    		</li>
				</ul>
				<!-- ./tab栏 -->
		
				<!-- tab内容 -->
				<div id="myTabContent" class="tab-content">
		    		<div class="tab-pane fade in active" id="home"></div>
				</div>
				<!-- ./tab内容 -->

			</section>
			<!-- ./内容 -->
		</div>
  		<!-- ./内容域 -->
  
		<!-- /.content-wrapper -->
		<footer class="main-footer">
			<div class="pull-right hidden-xs">
				<b>Version</b> 2.3.3
			</div>
		<strong>Copyright &copy; 2014-2015 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights reserved.
		</footer>
		<div class="control-sidebar-bg"></div>
	</div>


	<!-- jQuery -->
	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	<!-- jquery.cookie -->
	<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
	<!-- jQuery UI 1.11.4 -->
	<script src="https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.js"></script>
	<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
	<script>
  		$.widget.bridge('uibutton', $.ui.button);
	</script>
	<!-- Bootstrap 3.3.6 -->
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script src="https://cdn.bootcss.com/raphael/2.2.7/raphael.min.js"></script>
	<!-- Slimscroll -->
	<script src="https://cdn.bootcss.com/jQuery-slimScroll/1.3.8/jquery.slimscroll.min.js"></script>
	<!-- FastClick -->
	<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
	<!-- AdminLTE App -->
	<script src="../adminlte/dist/js/app.min.js"></script>
	<!-- vue -->
	<script src="http://cdn.jsdelivr.net/vue/1.0.7/vue.min.js"></script>
	<!-- layer -->
	<script src="https://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>
	
	<script src="../js/jquery.mloading.js"></script>
	<script src="../js/byking.js"></script>
	<script src="../js/hostconfig.js"></script>
	<script src="../js/byking-tree-table.js"></script>
	<script src="../js/byking-data-table.js"></script>
	<script src="../js/byking-tree.js"></script>
	<script type="text/javascript">
	
	
	var main = new Vue({
	    el:"#main",
	    data: {
	    	menulist: null,
	    	name: $byking.getCookieValue("name")
	    },
	    methods:{
	    	openMenu:function($event,item){
	    		console.log(item.menu_url);
	        	$byking.openTab("#"+item.guid, item.menu_name, item.menu_url);
	        	$byking.setCloseView(".tab-close-btn",item.guid);
	    	},
	    	/* 登出  */
	    	logout:function() {
	    		var index = layer.confirm("确认登出？", {
					  btn: ["确认", "取消"] 
					}, function(index, layero){
						var url = $hostconfig.sysAuthHost+"/sso/logout?user_guid=" + $byking.getCookieValue("user_guid");
						$byking.getJSONWithToken(url,function(data){
							$byking.clearAccountInfo();
				    		window.location.href = "login.html";
						},function(data){
							layer.msg(data.responseJSON.message);
							layer.close(index);
						} );
					});
	    		
	    	},
	    	/* 修改用户密码 */
	    	modifyPassword:function() {
	    		var user_guid = $byking.getCookieValue("user_guid");
	    		if (user_guid == null) {
	    			window.location.href = "login.html";
	    			return;
	    		}
	    		var title = "修改密码";
	    		var url = "modifypassword.html?userId="+$byking.getCookieValue("user_guid");
	    		var area = ["700px", "300px"];
	    		$byking.showModal(title,url,area);
	    	},
	    	/* 修改用户信息 */
	    	modifyInfo:function() {
	    		var user_guid = $byking.getCookieValue("user_guid");
	    		if (user_guid == null) {
	    			window.location.href = "login.html";
	    			return;
	    		}
	    		var title = "修改账户【"+$byking.getCookieValue("username")+"】信息";
	    		var url = "modifysysuserinfo.html?userId="+$byking.getCookieValue("user_guid");
	    		var area = ["450px", "280px"];
	    		$byking.showModal(title,url,area);
	    	},
	    	/* 获取菜单 */
	    	getMenus:function() {
	    		var access_token = $byking.getCookieValue("access_token");
	    		if(access_token==null){
	    			layer.msg("请重新登录！");
	    			window.location.href = "login.html";
	    			return;
	    		}
	    		var user_guid = $byking.getCookieValue("user_guid");
	    		if (user_guid == null) {
	    			window.location.href = "login.html";
	    			return;
	    		}
	    		var url = $hostconfig.sysAuthHost + "/menu/tree?user_guid="+$byking.getCookieValue("user_guid");
	    		$byking.getJSONWithToken(url,function(data){
	    			main.menulist = data.data;
	    		});
	    	}
	    }
	});
	
	//设置首页
	$byking.setHome("home.html");
	
	//设置菜单
	main.getMenus();
	
	</script>
</body>
</html>
